package com.zack.serversocket;

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zack.util.ServerUtil;

public class MyServer{
	
	
	public static void main(String[] args) throws IOException {
		ServerSocket server= new ServerSocket(666);
		while(true) {
			Socket socket = server.accept();
			ServerUtil.addClient(socket);
			System.out.println("====="+socket.getPort()+"链接=====总在线："+ServerUtil.getClientList().size());
			Thread t = new Thread(new ClientService(socket));
			t.start();
		}
		
	}
			
}
